package com.xju.controller.book;


import com.xju.common.utils.JSONUtil;
import com.xju.entity.Books;
import com.xju.service.BookService;
import com.xju.service.impl.BookServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/book/getOne")
public class BookGetoneServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取参数
        req.setCharacterEncoding("utf-8");
        String BookID = req.getParameter("bookID");
       //调用service
        BookService bookService=new BookServiceImpl();
        Books b=bookService.getOne(BookID);
        JSONUtil.printByJSON(resp,b);

    }
}
